
Welcome to taterSALAD's Tutorial on how to script for Halo CE!
Part II: Intermediate Scripting
What you will need for this tutorial:
Halo Custom Edition
Notepad
Sapien
Tool
Valid .sound tag
Note: If you haven't did Part I, do not continue with this tutorial,
Overview:
In this part of the tutorial, we will cover more difficult scripting, as well as using trigger volumes.
We will be using tutorial.map again, and will make it when you enter a certain area, it will spawn a ghost,
as well as play a sound.
Remember, the command for entering trigger volumes is "volume_test_object <trigger volume> <object name>",
and for object_lists, the command is "volume_test_objects <trigger volume> <object list>".
Setting Up Our Scenario:
First, go ahead and load up script_test.scenario in Sapien.
In the Hierarchy View, go to Mission>Game Data>Trigger Volumes.
In the game window, right click on top of the red base to place a trigger volume.
But our trigger volume isn't the size we need it to be.
To change the size, click a side and drag it to the size you need, in this case, the top of the base.
In the Properties Palette, assign it the name "trigger_test".
Do not be alarmed if the trigger volume suddenly becomes red. All it means, is that the trigger volume is not selected.
To fix it, simple select the trigger volume again.
Now place a ghost or a vehicle of your choice in front of the base.
Check the "Not placed... Automatically" box, and don't worry about setting MP spawn flags.
Assign the name "ghost" to the vehicle.
Script Time!
Now, we are just going to add to our script file we created in the last part.
Open up tutorial.hsc
Skip down two lines, and add in (script startup tutorial_script_02
and tab, (begin
Now type in, "(sleep_until (volume_test_objects trigger_test (players)) 15)
Then on the next line, "(object_create ghost)".
And on the next line, (sound_impulse_start sound\music\cstrng\cstrng1 none 1)
Then close off your script.
So, the third line tells Halo to check every half-second to see if a player has entered the trigger volume
named "trigger_test", and not to continue executing the script until it does.
The second line tells Halo to create the object "ghost".
The third line tells Halo to play the sound reference, with a scale of 1, and it is not attached to a specific object.
Now compile your scripts and save as "script_test_02", and compile your map.

That's it for Tutorial II! If you know how to create AI, you can add in an "ai_place" command with the "not initially
created" checkbox on, and create some cool stuff. Also, you don't have to make a script for each group of commands.
I have made scripts that are around 40 lines in just one script, so yeah, it had some awesome results.
So good luck with you scripting "career".
taterSALAD